import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.DecoderResult;
import io.netty.handler.codec.http.*;

/**
 * @ClassName HttpHandler
 * @Description
 * @Author Jingxiao.Ye
 * @Date 2021/11/14 下午11:24
 * @Version V1.0
 * @Since JDK 11
 */
public class HttpHandler extends SimpleChannelInboundHandler<HttpMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, HttpMessage msg) throws Exception {
        DefaultFullHttpResponse defaultFullHttpResponse = new DefaultFullHttpResponse(HttpVersion.HTTP_1_0, HttpResponseStatus.OK,
                Unpooled.copiedBuffer("result".getBytes()));
        ctx.writeAndFlush(defaultFullHttpResponse);
        ctx.close();
    }
}
